<?php
/*

Version 0.1
SEMF - Web Desiging Framework for Sport Event Managment
Copyright (C) 2006, SEMF Developers

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

*/
include_once('action.php');
//Base Class for Component
class Component
{

	
	/* retrive the properties */
	public static function get_properties(){}
	
	/* retieve the containers 
	 * return value should be like .. 
	 * array( 	id1 => array (
	 					'x' => $x,
						'y' => $y,
						'width' => $width,
						'height' => $height
						),
				id2 => array (
	 					'x' => $x,
						'y' => $y,
						'width' => $width,
						'height' => $height
						),
				and so one... */	
	public static function build_containers( $parent_container, $properties)
	{
		return array();
	}
	
	/**
	 * retrieve the information about action handlers
	 */
	public static function get_action_info($component_id)
	{
		return NULL;
	}
	/**
	 * retrieve the information about databinding properites..
	 */
	public static function get_property_info($component_id, $properties)
	{
		return NULL;
	}
	/**
	 * retrive the link information
	 */
	public static function get_link_info($component_id, $links)
	{
		return NULL;
	}
	
	public static function load_html_properties( $properties, $html_properties)
	{
		return $html_properties;
	}
	
	public static function save_html_properties( $properties, $html_properties)
	{
		return $properties;
	}
	
	/**
	 * here to specify some include pathss..
	 */
	public static function get_include_paths()
	{
		/** example
		return array("js"=> array(	"dir"=> "js", //directory to be copied..
									"files"=> array("js/somexx/file1.js",
													"js/somexx/file2.js"),
									),
					"php"=> array( "dir"=> "utils",
									"files"=> array("php/someyy/file1.php",
													"php/someyy/file2.php"),
					"img"=> array( "dir"=> "img",
									"files"=> array("img/img1.gif",
													"img/img2.gif")));
		*/
		return array(); 
													
	}
	
	/** This happens when container changes.. */
	public static function adjust_properties_with_container($parent_container, $properties)
	{
		//anyway here we dont need to edit anything. since this is the parent controller.
		return $properties;
	}

	/**
	 *@return array(id=> array('target' => $index,
											'relative_to' => $last_line_x, // relative position
											'dir' => 'ver'); 
											// can have 'ver' for vertical, 'hor' for horizontal..
	 */
	public static function delcare_container_lines($properties)
	{
		return array(); // default to an empty array...
	}
	
	/** build properties dynamically if atmost one property is changed*/
	public static function build_properties($parent_container, $properties, $property_group, $key, $value)
	{
		if( $key != NULL )
		{
			$properties[$property_group][$key] = $value;
		}
		return 	$properties;
	}
	
}
?>